import type {
  StatisticalAnalysisPublicIdParams,
  StatisticalAnalysisPublicParams,
  StatisticalAnalysisSelectPointEnergyConsumeSumParams,
  StatisticalAnalysisSelectRegionEnergyConsumeListParams,
  StatisticalAnalysisSelectRegionEnergyConsumeSumResultItem,
  StatisticalAnalysisSelectShiftPointEnergyConsumeListParams,
  StatisticalAnalysisSelectTeamPointEnergyConsumeListParams,
} from '@/types'

const controller = getAjaxBaseUrl(
  '/statisticalAnalysis',
  '/energy',
)

/** 查询点位能源消耗汇总 */
export function selectPointEnergyConsumeSum(params: Partial<StatisticalAnalysisSelectPointEnergyConsumeSumParams>) {
  return get(`${controller}/selectPointEnergyConsumeSum`, params)
}

/** 查询点位能源品种 */
export function selectPointEnergyType(params: {
  pointId: StatisticalAnalysisPublicIdParams['pointId']
  dataTime: StatisticalAnalysisPublicParams['dataTime']
  type?: StatisticalAnalysisPublicParams['type']
}) {
  return get(`${controller}/selectPointEnergyType`, params)
}

/** 查询区域能源消耗列表 */
export function selectRegionEnergyConsumeList(params: Partial<StatisticalAnalysisSelectRegionEnergyConsumeListParams>) {
  return get(
    `${controller}/selectRegionEnergyConsumeList`,
    params,
  )
}

/** 查询区域能源消耗汇总 */
export function selectRegionEnergyConsumeSum(params: Partial<StatisticalAnalysisPublicParams>) {
  return get<
    StatisticalAnalysisSelectRegionEnergyConsumeSumResultItem[]
  >(`${controller}/selectRegionEnergyConsumeSum`, params)
}

/** 查询区域能源品种 */
export function selectRegionEnergyType(dataTime: StatisticalAnalysisPublicParams['dataTime']) {
  return get(`${controller}/selectRegionEnergyType`, { dataTime })
}

/** 查询班次点位能源消耗列表 */
export function selectShiftPointEnergyConsumeList(params: Partial<StatisticalAnalysisSelectShiftPointEnergyConsumeListParams>) {
  return get(
    `${controller}/selectShiftPointEnergyConsumeList`,
    params,
  )
}

/** 查询班次点位能源消耗列表 */
export function selectTeamPointEnergyConsumeList(params: Partial<StatisticalAnalysisSelectTeamPointEnergyConsumeListParams>) {
  return get(
    `${controller}/selectTeamPointEnergyConsumeList`,
    params,
  )
}

/** 班组能耗统计-查班次列表 */
export function selectShiftList(dataTime: string) {
  return get<string[]>(`${controller}/selectShiftList`, {
    dataTime,
  })
}

/** 班次、班组数据统计汇总 */
export function selectPointEnergyType2(params: {
  pointId: StatisticalAnalysisPublicIdParams['pointId']
  dataTime: StatisticalAnalysisPublicParams['dataTime']
  type?: StatisticalAnalysisPublicParams['type']
}) {
  return get<any>(`${controller}/analyse`, params)
}
